package com.skeleton.server.blog.control;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.skeleton.common.base.dto.ResultDto;
import com.skeleton.db.dto.BlogTagDto;
import com.skeleton.server.blog.service.IBlogTagService;
import com.skeleton.utils.SystemConstants;

@Controller
@RequestMapping("blog/tag/")
public class BlogTagControl {

	protected Logger logger = LogManager.getLogger(this.getClass());

	@Resource
	private IBlogTagService iBlogTagService;
	
	@RequestMapping("hot5")
	@ResponseBody
	public Map<String, Object> hot5(HttpServletRequest request) {
		logger.info("-------blog/tag/---hot5-----------------");
		Map<String, Object> map = new HashMap<String, Object>();

		ResultDto rd = iBlogTagService.getBlogTagHot5();
		if (rd.isSuccess()) {
			List<BlogTagDto> btdList = rd.getDtoList("BlogTagDtoList");
			map.put("btdList", btdList);
			map.put("result", SystemConstants.AJAX_SUCCESS);
		} else {
			map.put("result", SystemConstants.AJAX_FAILED_ALERT);
			map.put("msg", rd.getErrorMSG());
		}

		return map;
	}

}
